package cn.tutu.blockchain.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;

import cn.tutu.blockchain.common.MsgObj;
import cn.tutu.blockchain.common.Page;
import cn.tutu.blockchain.integral.entity.IntegralRecord;
import cn.tutu.blockchain.integral.service.IntegralRecordService;

@RequestMapping("/integralRecord")
@RestController
public class IntegralRecordController {

	@Autowired
	private IntegralRecordService integralRecordService;

	@RequestMapping("/getGridByUser")
	public MsgObj getGridByUser(String userId, Page page) {
		PageInfo<IntegralRecord> byModel = integralRecordService.getByUserId(userId, page);
		return MsgObj.buildSuccessObj(byModel.getList());
	}

	@RequestMapping("/create")
	public MsgObj create(IntegralRecord integralRecord) {

		integralRecordService.create(integralRecord);
		return MsgObj.buildSuccessMsg();
	}

}
